<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkComboBoxEntry extends TemplateGtkGladeWidgetCompiler_GtkComboBox{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		$sCompiled=TemplateGtkGladeWidgetCompiler_GtkComboBox::compileCreateWidget_($oObject,false);
		if(($sValue=$oObject->getProperty('text_column'))!==null){// 文本列
			$sCompiled.= "\t\t{$sVariableName}->set_text_column({$sValue});";
			//$sCompiled.= "\t\t{$sVariableName}->child->set_text(' '); ";
			//$sCompiled.= "\t\t{$sVariableName}->child->set_text(''); ";
		}
		if(($sActive=$oObject->getProperty('active'))!==null){// 菜单初始项
			$sCompiled.="\t\tif(\$oListStore->get_n_columns()>{$sActive})";
			$sCompiled.="\t\t\t{$sVariableName}->set_active({$sActive});";
		}
		return $sCompiled;
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget,TemplateGtkGladeWidgetPacking $oPacking){ }

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
